﻿using MongoDB.Driver.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace nMongo
{
    public partial class MongoEngine
    {
        public virtual T GetById<T>(object id)
            where T : class
        {
            T returned = this.Database.GetCollectionFromType<T>().FindOne(this.BuildIdentityQuery(id));

            //if (returned != null)
            //{
            //    this.AutoDetectPersistencyById(MongoPersistencyState.Retrieved, id);
            //}

            return returned;
        }
    }
}
